var api = {
  // 正式环境
  prod: {
    baseUrl: "https://api.caigou2003.com/",
    baseUrl2: "https://sso.caigou2003.com/",
    mBaseUrl: "https://m.caigou2003.com/",
  },
  // 测试环境
  test: {
    baseUrl: "https://testapi.caigou2003.com/",
    baseUrl2: "https://testsso.caigou2003.com/",
    mBaseUrl: "https://testm2.caigou2003.com/",
  },
};
// 自动识别正式测试环境
var host = window.location.host;
var reg = /test|localhost|127\.0\.0\.1/;
var { baseUrl, baseUrl2, mBaseUrl } = reg.test(host) ? api.test : api.prod;
var globalUrl = {
  login:
    baseUrl.indexOf("test") === -1
      ? "https://sso.caigou2003.com/#/login"
      : "https://testsso.caigou2003.com/#/login",
};
var ports = {
  //Zhang Y.L. Start
  verifyToken: baseUrl + "user/verification", //验证token有效性
  listComment: baseUrl + "front/comment/listComment", //获取评论列表
  addComment: baseUrl + "front/comment/addComment", //添加评论
  getTagList: baseUrl + "front/keyword/dynamic", //获取标签列表
  getTagListTdk: baseUrl + "front/keyword/dynamic/tdk", //获取标签列表
  queryBidTitle: baseUrl + "bid/queryBidTitle", //根据条件查询标讯列表
  getArticleList: baseUrl + "front/article/list", //获取文章列表
  articleClickCount: baseUrl + "front/article/saveArticleClickCount", //统计文章点击量
  articleLikeNums: baseUrl + "front/article/collectionLikes", //查询文章收藏点赞评论数量
  articleCollect: baseUrl + "front/article/collection", //收藏文章
  cancelArticleCollect: baseUrl + "front/article/unCollection", //取消收藏文章
  articleLike: baseUrl + "front/article/like", //取消收藏文章
  cancelArticleLike: baseUrl + "front/article/unLike", //取消收藏文章
  getMyCollection: baseUrl + "front/my/listMyCollectionArticle", //获取我的收藏列表
  getMyComments: baseUrl + "front/my/listMyComment", //获取我的评论列表
  getMyMessage: baseUrl + "front/my/listMyMessage", //获取我的消息列表
  getMyMessageDetail: baseUrl + "front/my/getAndReadSystemMessage", //获取我的消息详情
  getAccountInfo: baseUrl + "front/user/getUserDetail", //获取账户信息
  updateAccountInfo: baseUrl + "front/user/updateUserDetail", //获取账户信息
  uploadUserImage: baseUrl + "front/user/uploadImage", //上传用户头像
  updateNickname: baseUrl + "front/user/updateNickname", //更新用户昵称
  uploadBusinessCard: baseUrl + "front/upload/picture", //更新用户昵称
  getIndustryList: baseUrl + "front/dic/industry", //查询行业列表
  commitCooperation: baseUrl + "front/cooperation/add", //提交商业合作信息
  uploadCooperationPicture: baseUrl + "front/upload/picture", //上传图片
  getReportList: baseUrl + "front/dic/project", //获取我要报道列表
  commitReport: baseUrl + "front/report/add", //提交我要报道信息
  logout: baseUrl + "user/signOut", //退出登录
  getContributeType: baseUrl + "front/my/listContributeType", //个人中心-投稿管理-列表稿件类型接口
  getContributeChannel: baseUrl + "front/my/listContributeChannel", //个人中心-投稿管理-列表频道接口
  getContributePublishType: baseUrl + "front/my/listContributePublishType", //个人中心-投稿管理-列表发布类型接口
  getContributeConfig: baseUrl + "front/my/getContributeConfig", //个人中心-投稿管理-获取提交限制配置
  uploadContribute: baseUrl + "front/my/saveContribute", //个人中心-投稿管理-上传稿件
  getContributeList: baseUrl + "front/my/listMyContribute", //个人中心-我的投稿列表
  getContributeDetail: baseUrl + "front/my/getContributeDetail", //个人中心-稿件详情接口
  getFeedbackType: baseUrl + "clients/feedback/dic", //获取意见反馈类型
  submitFeedback: baseUrl + "clients/feedback/save", //提交意见反馈
  getLessonConfig: baseUrl + "front/my/getLessonConfig", //获取我要讲课配置接口
  listLessonSpan: baseUrl + "front/my/listLessonSpan", //获取我要讲课政府采购从业时间接口
  listLessonObject: baseUrl + "front/my/listLessonObject", //获取我要讲课授课对象接口
  saveLesson: baseUrl + "front/my/saveLesson", //提交我要讲课
  //Zhang Y.L. End
  //caoyong---start
  register_query: baseUrl + "user/register/query", //验证用户
  forgot_password: baseUrl + "user/forgot/password", //改密
  user_register: baseUrl + "user/register", //注册
  auth_login: baseUrl + "auth/login", //登录
  user_sendSmsCode: baseUrl + "user/sendSmsCode", //短信
  wx_authSignIn: baseUrl + "wx/authSignIn", //三方微信登录
  wx_wxUserInfo: baseUrl + "wx/wxUserInfo", //三方微信登录
  wx_token_auth: baseUrl + "wx/token/auth", //三方微信登录
  front_article_loadSpecialArticleList:
    baseUrl + "front/article/loadSpecialArticleList", //资讯专题列表
  wx_binding_wx_auth: baseUrl + "wx/binding/wx/auth", //三方微信登录
  front_article_audio_list: baseUrl + "front/article/audio/list", //专题-聊政采列表
  front_article_atlas_list: baseUrl + "front/article/atlas/list", //专题-图片专题列表
  author_post_list:
    baseUrl + "front/articlePromoter/listArticleByArticlePromoter", //根据推荐作者id获取作者所有文章接口
  user_userInfo: baseUrl + "user/userInfo", //联网获取并同步用户信息//保存用户信息 头像email等
  front_article_es_list: baseUrl + "front/article/es/list", //文章全局搜索，供搜索页面使用。
  front_label_list: baseUrl + "front/label/list", //tag标签列表页面使用。
  //caoyong---end
  // limingming---start
  loadChannelHotSearchData: baseUrl + "front/channel/loadChannelHotSearchData", // 获取热搜榜数据
};
var utils = {
  cookieUtils: {
    setCookie: function (cname, cvalue, exdays, callback) {
      exdays = exdays || 30;
      var d = new Date();
      d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
      var expires = "expires=" + d.toGMTString();
      document.cookie =
        cname +
        "=" +
        escape(cvalue) +
        "; expires=" +
        expires +
        "; domain=" +
        this.GetCookieDomain() +
        "; path=/";
      callback();
    },
    getCookie: function (cname) {
      var name = cname + "=";
      var ca = document.cookie.split(";");
      for (var i = 0; i < ca.length; i++) {
        var c = ca[i].trim();
        if (c.indexOf(name) == 0) {
          return unescape(c.substring(name.length, c.length));
        }
      }
      return "";
    },
    checkCookie: function () {
      var user = this.getCookie("username");
      if (user != "") {
        alert("欢迎 " + user + " 再次访问");
      } else {
        user = prompt("请输入你的名字:", "");
        if (user != "" && user != null) {
          setCookie("username", user, 30);
        }
      }
    },
    delCookie: function (
      cname //删除cookie
    ) {
      var exp = new Date();
      exp.setTime(exp.getTime() - 1);
      var cval = this.getCookie(cname);
      if (cval != null)
        document.cookie =
          cname + "=" + cval + ";path=/;expires=" + exp.toGMTString();
    },
    GetCookieDomain: function () {
      var host = location.hostname;
      var ip =
        /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
      if (ip.test(host) === true || host === "localhost") return host;
      var regex = /([^]*).*/;
      var match = host.match(regex);
      if (typeof match !== "undefined" && null !== match) host = match[1];
      if (typeof host !== "undefined" && null !== host) {
        var strAry = host.split(".");
        if (strAry.length > 1) {
          host = strAry[strAry.length - 2] + "." + strAry[strAry.length - 1];
        }
      }
      return "." + host;
    },
  },
  showPreview: function (file, img) {
    //图片预览兼容IE7+
    console.log(file, img);
    var ua = navigator.userAgent.toLowerCase();
    var url = "";
    if (/msie/.test(ua)) {
      url = file.value;
    } else {
      url = window.URL.createObjectURL(file.files[0]);
    }
    img.src = url;
  },
  showToast: function (options) {
    options = options || {};
    var toastOptions = {
      title:
        options.title ||
        (options.type == "success"
          ? "操作成功"
          : options.type == "warning"
          ? "操作失败"
          : "调用成功"),
      type: options.type || "default", //success warning default
    };

    var toastId = "toast-" + new Date().getTime();
    var html =
      '<div class="toast" id=' + toastId + ">" + toastOptions.title + "</div>";
    $("body").append(html);
    $("#" + toastId).addClass(toastOptions.type);
    setTimeout(function () {
      $("#" + toastId).css({ top: "100px", opacity: "1" });
    });
    setTimeout(function () {
      $("#" + toastId).css({ opacity: "0" });
      $("#" + toastId).on("transitionend", function () {
        $(this).remove();
      });
    }, 2000);
  },
  showModal: function (options) {
    options = options || {};
    var modalOptions = {
      title: options.title || "提示",
      content: options.content || "感谢您对政府采购信息网的支持！",
      showCancel: options.showCancel || false,
      success: options.success || function (res) {},
    };

    var modalId = "modal-" + new Date().getTime();
    var html =
      '<div class="dialog-modal" id=' +
      modalId +
      " >" +
      '<div class="mask"></div>' +
      '<div class="content-wrap">' +
      '<div class="bg"></div>' +
      '<div class="content">' +
      modalOptions.content +
      "</div>" +
      '<div class="btn-wrap">' +
      '<div class="btn-item btn-confirm">确认</div>' +
      "</div>" +
      "</div>" +
      "</div>";

    $("body").append(html);

    var reData = {
      confirm: false,
      cancel: false,
    };
    $("#" + modalId + " .btn-confirm").click(function () {
      $("#" + modalId).remove();
      reData.confirm = true;
      modalOptions.success(reData);
    });
  },
  testPhoneNumber: function (str) {
    var reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
    console.log(reg.test(str));
    return reg.test(str);
  },
  testEmail: function (value) {
    if (value.length > 50) return false;
    var myReg =
      /^([a-z0-9A-Z]+[- | a-z0-9A-Z . _]+@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-z]{2,})$/;
    return myReg.test(value);
  },
  base64ToFormData: function (str) {
    var base64String = str; /*base64图片串*/

    //这里对base64串进行操作，去掉url头，并转换为byte
    var bytes = window.atob(base64String.split(",")[1]);

    //处理异常，将ASCII码小于0的转换为大于0
    var ab = new ArrayBuffer(bytes.length);
    var ia = new Uint8Array(ab);
    for (var i = 0; i < bytes.length; i++) {
      ia[i] = bytes.charCodeAt(i);
    }

    //Blob对象
    var blob = new Blob([ab], { type: "image/jpeg" }); //type为图片的格式

    //FormData对象
    var fd = new FormData();
    //TDOD Ajax或者其他方式上传FormData对象
    //FormData对象接受三个参数，第三个参数为文件名，通常我们只传前两个参数，第三个参数不传则使用默认文件名，这里使用的Blob对象，所以需要一个文件名，用时间戳代替。
    fd.append("file", blob, Date.now() + ".jpg");
    return fd;

    /*
        var blob = this.dataURItoBlob(str); // 上一步中的函数
        var canvas = document.createElement('canvas');
        var dataURL = canvas.toDataURL('image/jpeg', 0.5);
        var fd = new FormData(document.forms[0]);
        fd.append("file", blob, 'image.png');

        return fd;*/
  },
  dataURItoBlob: function (base64Data) {
    var byteString;
    if (base64Data.split(",")[0].indexOf("base64") >= 0) {
      byteString = atob(base64Data.split(",")[1]);
    } else {
      byteString = unescape(base64Data.split(",")[1]);
    }
    var mimeString = base64Data.split(",")[0].split(":")[1].split(";")[0];
    var ia = new Uint8Array(byteString.length);
    for (var i = 0; i < byteString.length; i++) {
      ia[i] = byteString.charCodeAt(i);
    }
    return new Blob([ia], { type: mimeString });
  },
  getQueryVariable: function (variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
      var pair = vars[i].split("=");
      if (pair[0] == variable) {
        return decodeURIComponent(pair[1]);
      }
    }
    return null;
  },
  formatPhoneNumber: function (val) {
    return val.substr(0, 3) + "****" + val.substr(7);
  },
  isDate: function (str) {
    //如果是正确的日期格式返回true,否则返回false
    var regExp;
    regExp = /\b\d{4}-\d{1,2}-\d{1,2}\b/;
    //判断整体格式yyyy-mm-dd
    if (str != str.match(/\d{4}-\d{2}-\d{2}/gi)) {
      // alert('请输入日期格式为：yyyy-mm-dd!');
      return false;
    }

    var tmpArr;
    //tmpArr = str.split("-");
    tmpArr = str.split("-");

    var rYear, rMonth, rDay;
    rYear = parseInt(tmpArr[0]);
    rMonth = parseInt(tmpArr[1]);
    rDay = parseInt(tmpArr[2]);
    //判断月
    if (rMonth > 12 || rMonth < 1) {
      // alert('月份输入错误!');
      return false;
    }

    var rYearflag;

    //判断润年
    if (rYear % 100 == 0 && rYear % 4 == 0) {
      rYearflag = true;
    } else if (rYear % 4 == 0) {
      rYearflag = true;
    } else {
      rYearflag = false;
    }

    if (",1,3,5,7,8,10,12,".indexOf("," + rMonth + ",") != -1 && rDay < 32) {
      return true;
    } else if (",4,6,9,11,".indexOf("," + rMonth + ",") != -1 && rDay < 31) {
      return true;
    } else if (rDay < 29) {
      return true;
    } else if (rYearflag && rDay < 30) {
      return true;
    } else {
      // alert('天输入错误!');
      return false;
    }
  },
  //分享到新浪微博
  shareToWeibo: function (title, url, picurl, source, sourceUrl) {
    var _shareUrl = "http://v.t.sina.com.cn/share/share.php?"; //真实的appkey，必选参数
    _shareUrl += "&url=" + encodeURIComponent(url || document.location); //参数url设置分享的内容链接|默认当前页location，可选参数
    _shareUrl += "&title=" + encodeURIComponent(title || document.title); //参数title设置分享的标题|默认当前页标题，可选参数
    _shareUrl += "&source=" + encodeURIComponent(source || "政府采购信息网");
    _shareUrl +=
      "&sourceUrl=" +
      encodeURIComponent(sourceUrl || "https://www.caigou2003.com");
    _shareUrl += "&content=" + "utf-8"; //参数content设置页面编码gb2312|utf-8，可选参数
    _shareUrl += "&pic=" + encodeURIComponent(picurl || ""); //参数pic设置图片链接|默认为空，可选参数
    window.open(
      _shareUrl,
      "newwindow",
      "height=600,width=600,top=100,left=100"
    );
  },
  //分享到QQ空间
  shareToQzone: function (
    title,
    url,
    picurl,
    desc,
    summary,
    source,
    showcount
  ) {
    var _shareUrl =
      "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?";
    _shareUrl += "url=" + encodeURIComponent(url || document.location); //参数url设置分享的内容链接|默认当前页location
    _shareUrl += "&showcount=" + showcount || 0; //参数showcount是否显示分享总数,显示：'1'，不显示：'0'，默认不显示
    _shareUrl += "&desc=" + encodeURIComponent(desc || ""); //参数desc设置分享的描述，可选参数
    _shareUrl += "&summary=" + encodeURIComponent(summary || "分享摘要"); //参数summary设置分享摘要，可选参数
    _shareUrl += "&title=" + encodeURIComponent(title || document.title); //参数title设置分享标题，可选参数
    _shareUrl += "&site=" + encodeURIComponent(source || "政府采购信息网"); //参数site设置分享来源，可选参数
    _shareUrl += "&pics=" + encodeURIComponent(picurl || ""); //参数pics设置分享图片的路径，多张图片以＂|＂隔开，可选参数
    window.open(
      _shareUrl,
      "newwindow",
      "height=600,width=600,top=100,left=100"
    );
  },
  shareWeixin: function (url) {
    var html =
      '<div id="wx-share">\n' +
      '        <div class="mask"></div>\n' +
      '        <div class="bd_weixin_popup_head">\n' +
      '            <div class="title">分享到微信朋友圈</div>\n' +
      '            <a class="bd_weixin_popup_close">×</a>\n' +
      '            <div id="weixin-qrcode"></div>\n' +
      '            <div class="bd_weixin_popup_foot">打开微信，点击底部的“发现”，<br>使用“扫一扫”即可将网页分享至朋友圈。</div>\n' +
      "        </div>\n" +
      "    </div>";
    $(".container").append(html);
    $("#wx-share").css("display", "block");

    var locationUrl = window.location.href;
    var articleId = locationUrl.substring(
      locationUrl.lastIndexOf("/") + 1,
      locationUrl.lastIndexOf(".html")
    );
    var type = "";
    if (locationUrl.match("/news/")) {
      type = "info";
    } else if (locationUrl.match("/law/")) {
      type = "law";
    } else if (locationUrl.match("/case/")) {
      type = "case";
    } else if (locationUrl.match("/audio/")) {
      type = "yllzc";
    } else if (locationUrl.match("/album/")) {
      type = "atlas";
    } else if (locationUrl.match("/special/")) {
      type = "special"
    }
    var redirectUrl = type
      ? mBaseUrl + "article/" + type + "?articleId=" + articleId
      : locationUrl;

    var path = url || redirectUrl; //获取页面的链接
    $("#weixin-qrcode").qrcode({
      text: path, //设置二维码内容
      // render: "table", //设置渲染方式
      width: 185, //设置宽度,默认生成的二维码大小是 256×256
      height: 185, //设置高度
      typeNumber: -1, //计算模式
      background: "#ffffff", //背景颜色
      foreground: "#000000", //前景颜色
    });
    $(".bd_weixin_popup_close").click(function () {
      $("#wx-share").remove();
    });
  },
  shareLongWeibo: function (picurl, title, url) {
    this.shareToWeibo();
    /*var html = '\n' +
            '    <div id="share-long-weibo">\n' +
            '        <div class="mask"></div>\n' +
            '        <div class="share-content">\n' +
            '            <div class="close">×</div>\n' +
            '            <div class="title">分享长微博</div>\n' +
            '            <div class="share-wrap">\n' +
            '                <img src=' + picurl + ' alt="分享图片">\n' +
            '                <div class="share-btn" onclick="utils.shareToWeibo(' + "'" + (title || '') + "','" + (url || '') + "','" + picurl + "'" + ')">分享长微博</div>\n' +
            '            </div>\n' +
            '        </div>\n' +
            '    </div>';
        $('.container').append(html);
        $('#share-long-weibo .close').click(function () {
            $('#share-long-weibo').remove();
        });*/
  },
  computedArticleHeight: function () {
    console.log($("#main").height());
    // $('aside.right-area .area-3').css({display:'none'});
    if ($("#main").height() > 3100) {
      $("aside.right-area .control").css({ display: "block" });
    } else if ($("#main").height() > 2031) {
      $("aside.right-area .area-1,aside.right-area .area-2").css({
        display: "block",
      });
      $("aside.right-area .area-3").css({ display: "none" });
    } else {
      $("aside.right-area .area-1")
        .css({ display: "block" })
        .siblings()
        .css({ display: "none" });
    }
  },
};
var token = utils.cookieUtils.getCookie("token");
var userInfo = {};
try {
  userInfo = JSON.parse(utils.cookieUtils.getCookie("userInfo"));
} catch (e) {}

$.ajaxSetup({
  method: "post",
  async: false,
  dataType: "json",
  contentType: "application/json;charset=utf-8",
  /*headers: {
        'Authorization': token
    },*/
  complete: function (XMLHttpRequest, textStatus) {
    var res = XMLHttpRequest.responseJSON;
    if (res && res.status != 200 && res.resCode != 200) {
      if (res.status == 401) {
        console.log("未登录");
        window.location.replace(
          globalUrl.login +
            "?returnUrl=" +
            encodeURIComponent(window.location.href)
        );
      } else {
        console.log(res);
        utils.showToast({
          title: res.message || res.resMessage,
          type: "warning",
        });
      }
    }
  },
  error: function (jqXHR, textStatus, errorThrown) {
    switch (jqXHR.status) {
      case 500:
        console.log("服务器系统内部错误");
        utils.showToast({
          title: "服务器系统内部错误",
          type: "warning",
        });
        break;
      case 401:
        console.log("未认证");
        utils.showToast({
          title: "未认证",
          type: "warning",
        });
        break;
      case 403:
        console.log("无权限执行此操作");
        utils.showToast({
          title: "无权限执行此操作",
          type: "warning",
        });
        break;
      case 404:
        console.log("地址未找到");
        utils.showToast({
          title: "地址未找到",
          type: "warning",
        });
        break;
      case 408:
        console.log("请求超时");
        utils.showToast({
          title: "请求超时",
          type: "warning",
        });
        break;
      default:
        console.log("未知错误");
        utils.showToast({
          title: "未知错误",
          type: "warning",
        });
    }
  },
  cache: false,
});
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
  // console.log('开始请求之前',options,originalOptions)
  options.headers = {
    Authorization: utils.cookieUtils.getCookie("token"),
  };
  if (options.type.toLowerCase() == "post" && originalOptions.data) {
    options.data = JSON.stringify(originalOptions.data);
  }
});

$(function () {
  $(".share .weibo").html(
    '<img src="/web/img/icon_weibo.png" alt="微博">分享到微博'
  );

  // Zhang Y.L. 202011191019 start
  computedMainHeight();
  utils.computedArticleHeight();

  function computedMainHeight() {
    var oHeaderHeight = $("#header").outerHeight() || 82;
    var oFooterHeight = $("#footer").outerHeight() || 282;
    var clientHeight =
      document.documentElement.clientHeight || document.body.clientHeight;
    $("#main").css({
      minHeight: clientHeight - oHeaderHeight - oFooterHeight - 78 + "px",
    });
  }

  // Zhang Y.L. 202011191019 end

  include();

  function include() {
    var $aInclude = $("include");
    $aInclude.each(function (i) {
      if (!!$(this).attr("file")) {
        var $includeObj = $(this);
        $.ajax({
          url: $includeObj.attr("file"),
          method: "get", //caoyong20200915增加行
          dataType: "",
          context: document.body,
          success: function (html) {
            $includeObj.after(html).remove();
            if (i == $aInclude.length - 1) {
              //var script = $('<script src="/web/lib/less.min.js"></script>');   //创建script标签
              //$('body').append(script);  //将标签插入body尾部
              include();
            }
          },
        });
      }
    });
  }

  var pageY = 0;
  $(window).scroll(function () {
    // console.log("检测到页面滚动事件:"+window.pageYOffset);
    var nowPageY = window.pageYOffset;
    if (nowPageY > pageY) {
      //向下滚动
      if (nowPageY > 80) {
        $("header").css("top", "-82px");
      }
      if (nowPageY > 270) {
        $("#share-menu-wrap").css({
          position: "fixed",
          top: "0",
          left: "auto",
        });
      }
    } else if (nowPageY < pageY) {
      //向上滚动
      $("header").css("top", "0");
      if (nowPageY <= 270) {
        $("#share-menu-wrap").css({
          position: "absolute",
          top: "210px",
          left: "0",
        });
      } else {
        $("#share-menu-wrap").css({
          top: "82px",
        });
      }
    }

    pageY = nowPageY;
  });

  $("#main-content .content-wrap ul.enclosure>li").click(function () {
    var url = $(this).data("url");
    var fileType = url.substr(url.lastIndexOf("."));

    if (fileType === ".pdf") {
      window.open($(this).data("url"), "newwindow");
      return false;
    }
    window.open(url, "_self");
  });

  $.ajax({
    url: ports.verifyToken,
    success: function (res) {
      console.log("验证token是否有效", res);
      if (res.status == 200) {
        if (res.data) {
          $("#header-btn .login").css("display", "none");
          $("#header-btn .active").css("display", "inline");
        } else {
          token = "";
          utils.cookieUtils.delCookie("token");
          localStorage.removeItem("userInfo");
          $("#header-btn .login").css("display", "inline");
          $("#header-btn .active").css("display", "none");
        }
      }
    },
  });
});
